package com.trg.flex.remote
{
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.Operation;
	import mx.rpc.remoting.RemoteObject;
	
	public class ROCall extends AsyncTokenCall
	{
		public function ROCall(target:RemoteObject = null, method:String = null, ...params:*)
		{
			this.target = target;
			this.method = method;
			this.params = params;
			super();
		}
		
		public var target:RemoteObject;
		public var method:String;
		public var params:Array;
		
		override public function fire(callback:Function):void {
			var operation:Operation = target[method];
			operation.arguments = params;
			var token:AsyncToken = operation.send();
			setToken(token, callback);
		}
	}
}